from django.db import models
from django.contrib.auth.hashers import make_password, check_password


# Create your models here.

class RootModel(models.Model):
    username = models.CharField(max_length=16, primary_key=True)
    _password = models.CharField(max_length=255)

    @property
    def password(self):
        return self._password

    @password.setter
    def password(self, pwd):
        self._password = make_password(pwd)

    def check_pwd(self, pwd):
        return check_password(pwd,self._password)
